<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Map.Entry"%>
<%@page import="java.util.Set"%>
<%@page import="java.util.Map"%>
<%@page import="java.util.List"%>
<%@ page import="org.tloss.proxyserver.*" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>IN ADMIN PANEL | Powered by INDEZINER</title>
<link rel="stylesheet" type="text/css" href="<%=response.encodeURL(request.getContextPath()+"/proxyadmin/resources/css/style.css")%>" />
<script type="text/javascript" src="<%=response.encodeURL(request.getContextPath()+"/proxyadmin/resources/js/clockp.js")%>"></script>
<script type="text/javascript" src="<%=response.encodeURL(request.getContextPath()+"/proxyadmin/resources/js/clockh.js")%>"></script> 
<script type="text/javascript" src="<%=response.encodeURL(request.getContextPath()+"/proxyadmin/resources/js/jquery.min.js")%>"></script>
<script type="text/javascript" src="<%=response.encodeURL(request.getContextPath()+"/proxyadmin/resources/js/ddaccordion.js")%>"></script>
<script type="text/javascript">
ddaccordion.init({
	headerclass: "submenuheader", //Shared CSS class name of headers group
	contentclass: "submenu", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["suffix", "<img src='<%=response.encodeURL(request.getContextPath()+"/proxyadmin/resources/images/plus.gif")%>' class='statusicon' />", "<img src='<%=response.encodeURL(request.getContextPath()+"/proxyadmin/resources/images/minus.gif")%>' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})
</script>

<script type="text/javascript" src="<%=response.encodeURL(request.getContextPath()+"/proxyadmin/resources/js/jconfirmaction.jquery.js")%>"></script>
<script type="text/javascript">
	var niceforms_imagesPath ="<%=response.encodeURL(request.getContextPath()+"/proxyadmin/resources/img/")%>";
	$(document).ready(function() {
		$('.ask').jConfirmAction();
	});
	
</script>

<script language="javascript" type="text/javascript" src="<%=response.encodeURL(request.getContextPath()+"/proxyadmin/resources/js/niceforms.js")%>"></script>
<link rel="stylesheet" type="text/css" media="all" href="<%=response.encodeURL(request.getContextPath()+"/proxyadmin/resources/css/niceforms-default.css")%>" />

</head>
<body>
<div id="main_container">

	<div class="header">
    <div class="logo"><a href="#"><img src="<%=response.encodeURL(request.getContextPath()+"/proxyadmin/resources/images/logo.gif")%>" alt="" title="" border="0" /></a></div>
    <% UserInfo info = (UserInfo)session.getAttribute("userInfo"); %>
    <div class="right_header">Welcome <%=info.getEmail()%>| <a href="<%=response.encodeURL(request.getContextPath()+"/proxyadmin/logout")%>" class="logout">Logout</a></div>
    <div id="clock_a"></div>
    </div>
    
    <div class="main_content">
    
                     <div class="menu">
                    <ul>
                    <li><a class="current" href="<%=response.encodeURL(request.getContextPath()+ Constants.INDEX_PATH)%>">Admin Home</a></li>
                    <li><a href="<%=response.encodeURL(request.getContextPath()+ Constants.ADD_CONTEXT_PATH)%>">Add Context</a></li>
                    </ul>
                    </div> 
                    
                    
                    
                    
    <div class="center_content">  
    
    
    
    <div class="left_content">   
            <div class="sidebarmenu">
                <a class="menuitem submenuheader" href="">Context</a>
                <div class="submenu">
                    <ul>
                    <li><a href="<%=response.encodeURL(request.getContextPath()+ Constants.INDEX_PATH)%>">List Context</a></li>
                    <li><a href="<%=response.encodeURL(request.getContextPath()+ Constants.ADD_CONTEXT_PATH)%>">Add context</a></li>
                    </ul>
                </div>    
                
                    
            </div>
    </div>  
    
    <div class="right_content">            
    <h2>List context</h2> 
      <%                    
       
      Map<String,ProxyEntry> contextEntries = (Map<String,ProxyEntry>) request.getAttribute("proxyEntries");
      String context = (String) request.getAttribute("context");
      %>
<table id="rounded-corner" summary="2007 Major IT Companies' Profit">
    <thead>
    	<tr>
        	<th scope="col" class="rounded-company"></th>
        	<th scope="col" class="rounded">Hash</th>
            <th scope="col" class="rounded">Context</th>
            <th scope="col" class="rounded">Protocol</th>
            <th scope="col" class="rounded">Host</th>
            <th scope="col" class="rounded">Port</th>
            <th scope="col" class="rounded">Context</th>
            <th scope="col" class="rounded">Status</th>
            
            <th scope="col" class="rounded">Edit</th>
            <th scope="col" class="rounded-q4">Delete</th>
        </tr>
    </thead>
        <tfoot>
    	<tr>
    	<%if(contextEntries ==null ||contextEntries.isEmpty()){ %>
        	<td colspan="9" class="rounded-foot-left"><em>No Proxy.</em></td>
        	<td class="rounded-foot-right">&nbsp;</td>
		<%}else{ %>
			<td colspan="9" class="rounded-foot-left"><em>Total: <%=contextEntries.size() %> Proxy(s).</em></td>
        	<td class="rounded-foot-right">&nbsp;</td>
		<%} %>
        </tr>
    </tfoot>
    <tbody>
    <% 
    	if(contextEntries !=null &&!contextEntries.isEmpty()){
    		Set<Entry<String,ProxyEntry>> entries =  contextEntries.entrySet();
    		ProxyEntry tmp;
    		for(Iterator<Entry<String,ProxyEntry>> i =entries.iterator();i.hasNext();){
    			tmp = i.next().getValue();
    %>
    	<tr>
        	<td><input type="checkbox" name="" value="<%=tmp.getContext() %>" /></td>
            <td><%=tmp.getHash() %></td>
            <td><%=tmp.getContext() %></td>
            <td><%=tmp.getProtocol() %></td>
            <td><%=tmp.getHost() %></td>
            <td><%=tmp.getPort() %></td>
            <td><%=tmp.getContext() %></td>
            <td><%=tmp.getStatus()== ProxyEntry.ENABLE_ONLINE?"Enable-Online":(tmp.getStatus()== ProxyEntry.ENABLE_OFFLINE?"Enable-Offline":"Disable")%></td>

            <td><a href="#"><img src="<%=response.encodeURL(request.getContextPath()+"/proxyadmin/resources/images/user_edit.png")%>" alt="" title="" border="0" /></a></td>
            <td><a href="#" class="ask"><img src="<%=response.encodeURL(request.getContextPath()+"/proxyadmin/resources/images/trash.png")%>" alt="" title="" border="0" /></a></td>
        </tr>
       <%}
    		}%>        
    </tbody>
</table>

	 <a href="<%=response.encodeURL(request.getContextPath()+Constants.ADD_PROXY_ENTRY_PATH+"?proxyContext="+context) %>" class="bt_green"><span class="bt_green_lft"></span><strong>Add new item</strong><span class="bt_green_r"></span></a>
     
         
     
     </div><!-- end of right content-->
            
                    
  </div>   <!--end of center content -->               
                    
                    
    
    
    <div class="clear"></div>
    </div> <!--end of main content-->
	
    
    <div class="footer">
    
    	<div class="left_footer">IN ADMIN PANEL | Powered by <a href="http://indeziner.com">INDEZINER</a></div>
    	<div class="right_footer"><a href="http://indeziner.com"><img src="<%=response.encodeURL(request.getContextPath()+"/proxyadmin/resources/images/indeziner_logo.gif")%>" alt="" title="" border="0" /></a></div>
    
    </div>

</div>		
</body>
</html>